package sample;


import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
import sample.common.ViewStage;

public class A extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        ProgressIndicator progressIndicator =  new ProgressIndicator();
        ViewStage viewStag = new ViewStage(progressIndicator);
//        viewStag.stageShow();
        MYTask myTask = new MYTask(viewStag);
        Thread thread = new Thread(myTask);
        thread.setDaemon(true);
        thread.start();
        myTask.progressProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
                progressIndicator.setProgress(newValue.doubleValue());
            }
        });
    }

    public static void main(String[] args) {
        launch(sample.A.class,args);
    }
}
